package cn.yj.wx.pay.enrity.refund;

import lombok.Data;

import java.util.List;
import java.util.Map;

/**
 * 退款接口接收结果
 * @author 永健
 * @since 2021-10-21 10:52
 */
@Data
public class WechatRefundResult {

    private String refund_id;

    private String out_refund_no;

    private String reason;

    private String transaction_id;

    private String out_trade_no;

    private String channel;

    private String user_received_account;

    private String success_time;

    private String create_time;

    /**
     * 请看枚举： RefundStatus.class
     * SUCCESS("退款成功"),CLOSED("退款关闭"),PROCESSING("退款处理中"),ABNORMAL("退款异常");
     */
    private String status;

    private String statusMsg;

    private String funds_account;

    private Amount amount;

    private Map<String, Object> promotion_detail;

    @Data
    public static class Amount {

        /**
         * 退款金额
         */
        private int refund;

        /**
         * 订单金额
         */
        private int total;

        /**
         * 退款出资账户及金额
         * map:{
         * account:'', 出资账户类型
         * amount:1, 出资金额
         * }
         */
        private List<Map> from;

        /**
         * 用户支付金额
         */
        private int payer_total;

        /**
         * 用户退款金额
         */
        private int payer_refund;

        /**
         * 应结退款金额
         */
        private int settlement_refund;

        /**
         * 应结订单金额
         */
        private int settlement_total;

        /**
         * 优惠退款金额
         */
        private int discount_refund;

        private String currency;
    }

    public String getStatusMsg() {
        return statusMsg;
    }

    public WechatRefundResult setStatusMsg(String statusMsg) {
        this.statusMsg = statusMsg;
        return this;
    }
}
